/**
* @Title: RzCompare.java
* @Package com.taxsearch.service
* @Description: TODO(用一句话描述该文件做什么)
* @author STIVEN
* @date 2018年11月6日
* @version V1.0
*/
package com.taxsearch.service;

import com.taxsearch.controller.OcrAratek;
import com.taxsearch.controller.OcrResoluController;
import com.taxsearch.controller.checkin.CheckInController;
import com.taxsearch.service.linsa.CheckInService;
import org.apache.log4j.Logger;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;



/**
* @ClassName: RzCompare
* @Description: TODO(这里用一句话描述这个类的作用)
* @author STIVEN
* @date 2018年11月6日
*
*/
@Service
public class RzCompare {
	//@Autowired
	//private CheckInService checkInService;
	private static Logger logger = Logger.getLogger(CheckInController.class);

	/**
	 * 
	* @Title: doCompearIDcardAndPhoto
	* @Description: TODO(异步线程比较身份证和现场照)
	* @param     参数
	* @return void    返回类型
	 */
	@Async
	public void doCompearIDcardAndPhoto(CheckInService checkInService, String DJ_LVKEDAIMA, String IDNumber, String name, String tel, String IDPhoto, String photo){
		OcrResoluController ocrCheck= new OcrResoluController();
		OcrAratek ocrAratek=new OcrAratek();
		boolean flag=false;
		try {
		if(!ocrAratek.doReqAratekTrustFace(photo, ocrCheck.getIDCardPhotoImgBase64(IDPhoto))) {
			if(!ocrCheck.OcrResolutionByPhoto(IDNumber, name, photo, tel)) {//人证验证
				checkInService.updateRzStatus(DJ_LVKEDAIMA);
		}else {
			flag=true;
		}
		}else {
			flag=true;

		}
		if(flag) {
			checkInService.updateRzStatusSuccess(DJ_LVKEDAIMA);
		}
		}catch (Exception e) {
			logger.error("doCompearIDcardAndPhoto-发生错误!!!!!!!!!!!!!!!!!!!!!!!!", e);

		}
	}
}
